<?php /* Smarty version Smarty-3.1.14, created on 2017-08-18 14:46:50
         compiled from "E:\phpStudy\WWW\zyshop\admin\templates\goods_type.html" */ ?>
<?php /*%%SmartyHeaderCode:61875995123726e457-19802686%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '03d162ca5394c695bbeffb9efd8af156792e5c9b' => 
    array (
      0 => 'E:\\phpStudy\\WWW\\zyshop\\admin\\templates\\goods_type.html',
      1 => 1503038723,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '61875995123726e457-19802686',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.14',
  'unifunc' => 'content_599512372a5395_35239661',
  'variables' => 
  array (
    'info' => 0,
    'list' => 0,
    'page' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_599512372a5395_35239661')) {function content_599512372a5395_35239661($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ("header.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

<style>
th{ text-align:left;}
</style>
<body>
<div class="fixed-bar">
  <div class="item-title">
    <h3>商品类型</h3>
    <div style="background:rgba(251,112,45,1);width:125px;height:40px;float:right;text-align:center;border-radius:5px;">
      <a href="goods_type.php?act=edit">
        <h5 style="padding:10px;color:#fff;">添加类型</h5>
      </a>
    </div>
  </div>
</div>
<div class="fixed_bottom">
  <form method="post" action="" id="aspnetForm" name="form1">
    <table align="center;" class="table tb-type2">
      <thead>
        <tr>
          <th width="50"><a>编号</a></th>
          <th width="25%"><a>类型名称</a></th>
          <th><a>属性说明</a></th>
          <th><a>状态</a></th>
          <th><a>排序</a></th>
          <th width="10%"><a>操作</a></th>
        </tr>
      </thead>
      <tbody>
      	<?php  $_smarty_tpl->tpl_vars['list'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['list']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['info']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['list']->key => $_smarty_tpl->tpl_vars['list']->value){
$_smarty_tpl->tpl_vars['list']->_loop = true;
?>
      	<tr class="par_<?php echo $_smarty_tpl->tpl_vars['list']->value['parent_id'];?>
">
          <td><?php echo $_smarty_tpl->tpl_vars['list']->value['cat_id'];?>
</td>
          <td><?php echo $_smarty_tpl->tpl_vars['list']->value['cat_name'];?>
</td>
          <td><?php echo $_smarty_tpl->tpl_vars['list']->value['attr_group'];?>
</td>
          <td><i style="cursor:pointer;" onclick="ajax_enabled(this,<?php echo $_smarty_tpl->tpl_vars['list']->value['cat_id'];?>
,<?php echo $_smarty_tpl->tpl_vars['list']->value['enabled'];?>
)" class="fa <?php if ($_smarty_tpl->tpl_vars['list']->value['enabled']==1){?>fa-close <?php }else{ ?>fa-check<?php }?>"></i></td>
          <td><?php echo $_smarty_tpl->tpl_vars['list']->value['sort_order'];?>
</td>
          <td><a href="attribute.php?act=list&goods_type=<?php echo $_smarty_tpl->tpl_vars['list']->value['cat_id'];?>
">属性列表</a> | <a href="goods_type.php?act=edit&c_id=<?php echo $_smarty_tpl->tpl_vars['list']->value['cat_id'];?>
">编辑</a> | <span style="cursor:pointer;" onclick="ajax_del(this,<?php echo $_smarty_tpl->tpl_vars['list']->value['cat_id'];?>
)">删除</span></td>
        </tr>
        <?php } ?>
      
    </table>
    <div class="page"><?php echo $_smarty_tpl->tpl_vars['page']->value;?>
</div>
  </form>
</div>
</body>
<script>
//ajax删除商品分类
function ajax_del(obj,id){
    layer.confirm('删除商品类型将会清除该类型下的所有属性,您确定要删除选定的商品类型吗？', {
      btn: ['确认','取消'] //按钮
    }, function(){
        $.post("goods_type.php",{act:'ajax_del',cat_id:id},function(data){
            if(data==1){
                  $(obj).parent().parent().remove();
                  layer.msg("操作成功! ");
            }else if(data==2){
                  layer.msg("操作失败！");
            }
        });     
    }, function(){
       layer.msg('明白了', {
       time: 1000//20s后自动关闭
       });
    });
}
//ajax改变是否状态
function ajax_enabled(obj,id,price){
  if(price==1){
    prices="1";
  }else{
    prices="2";
  }
  $.post("goods_type.php",{act:'ajax_enabled',cat_id:id,zt:prices},function(data){
      if(data==1){
      layer.msg("操作成功！");
      if(prices==1){
        $(obj).attr("onclick","ajax_enabled(this,"+id+",2)");
        $(obj).removeClass("fa-close");
        $(obj).addClass("fa-check");
      }else if(prices==2){
        $(obj).attr("onclick","ajax_enabled(this,"+id+",1)");
        $(obj).removeClass("fa-check");
        $(obj).addClass("fa-close");
      }
    }else if(data==2){
      layer.msg("操作失败！");
    }
  });  
}
</script>
</html><?php }} ?>